import { http } from '@/utils/http';
import type { AnyObj } from '@/types/global';
import { getWxUserId } from '@/utils/auth';

export const getMessageList = (data : AnyObj) => {
	return http<AnyObj[]>({
		method: 'GET',
		url: `/wx/message/list`,
		data: {
			...data,
			receiverId: getWxUserId()
		}
	});
}


export const getMessageDetail = (id : string) => {
	return http<AnyObj>({
		method: 'GET',
		url: `/wx/message/${id}`,
	});
}

export const saveMessageMarkAsRead = (id : string) => {
	return http({
		method: 'POST',
		url: `/wx/message/markAsRead`,
		data: { id }
	});
}


export const deleteMessage = (id : string) => {
	return http({
		method: 'DELETE',
		url: `/wx/message/removeMessage/${id}`,
	});
}